package lanQiaoBei.基础算法.位运算;

import java.io.*;

/*
 * 求一个数x的二进制位有几个1
 * */
public class P2 {
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    
    static int lowbit(int x){
    	   return x & -x;
    }
    public static void main(String[] args) throws NumberFormatException, IOException {
		   int x=Integer.parseInt(br.readLine());
		   int res=0;
		   while(x>0){
			     int t=lowbit(x);
			     System.out.println(t);
			     x-=t;
			     res++;
		   }
		   System.out.print(res);
	}
}
